package com.yystar.support.handler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;

import com.yystar.support.base.util.AppUtility;

public class ExceptionResolverHandler extends SimpleMappingExceptionResolver {

	@Override
	protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
		AppUtility.recordException(ex);
		if (request.getHeader("x-requested-with") != null)
			return super.doResolveException(request, response, handler, ex);
		return new ModelAndView("500");
	}
}
